﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/revoelectric.master" title="Billing | Revo" CodeFile="Premises.aspx.cs" Inherits="Premises" %>

<asp:Content ID="Content1" runat="server" ContentPlaceHolderID="head">
</asp:Content>

<asp:Content ID="Content2" runat="server" ContentPlaceHolderID="widebarHeaderContentPlaceHolder">

</asp:Content>

<asp:Content runat="server" ID="generatebill_content" ContentPlaceHolderID="widebarBodyContentPlaceHolder">
    <form id="formPremiseGrid" runat="server">
        <div>
            <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="#999999" BorderStyle="None" BorderWidth="1px" CellPadding="3" 
                DataKeyNames="id" DataSourceID="ccDb" EnableModelValidation="True" 
                GridLines="Vertical">
                <AlternatingRowStyle BackColor="#DCDCDC" />
                <Columns>
                    <asp:BoundField DataField="id" HeaderText="Id" InsertVisible="False" 
                        ReadOnly="True" SortExpression="id" />
                    <asp:BoundField DataField="street" HeaderText="Street" 
                        SortExpression="street" />
                    <asp:BoundField DataField="province" HeaderText="Province" 
                        SortExpression="province" />
                    <asp:BoundField DataField="city" HeaderText="City" SortExpression="city" />
                    <asp:BoundField DataField="country" HeaderText="Country" 
                        SortExpression="country" />
                    <asp:CommandField ShowEditButton="True" />
                </Columns>
                <FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
                <HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
                <PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
                <RowStyle BackColor="#EEEEEE" ForeColor="Black" />
                <SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
            </asp:GridView>
			<asp:SqlDataSource ID="ccDb" runat="server" 
                ConnectionString="<%$ ConnectionStrings:onwindConnectionString %>" 
                SelectCommand="SELECT [id], [street], [province], [city], [country] FROM [premise]" 
                InsertCommand="INSERT INTO [premise] ([street], [province], [city], [country]) VALUES (@street, @province, @city, @country)"
                UpdateCommand="UPDATE [premise] SET [street]=@street, [province]=@province, [city]=@city, [country]=@country WHERE [id]=@id">
            </asp:SqlDataSource>
            <asp:FormView ID="FormView1" runat="server" DataKeyNames="id" 
                DataSourceID="ccDb" DefaultMode="Insert" EnableModelValidation="True">
                                
                <InsertItemTemplate>
                    <h3>Add New Premises</h3>
                    <span class="txtLabel">Street:</span>
                    <asp:TextBox ID="streetTextBox" runat="server" Text='<%# Bind("street") %>' />
                    <br />
                    <span class="txtLabel">Province:</span>
                    <asp:TextBox ID="provinceTextBox" runat="server" 
                        Text='<%# Bind("province") %>' />
                    <br />
                    <span class="txtLabel">City:</span>
                    <asp:TextBox ID="cityTextBox" runat="server" Text='<%# Bind("city") %>' />
                    <br />
                    <span class="txtLabel">Country:</span>
                    <asp:TextBox ID="countryTextBox" runat="server" Text='<%# Bind("country") %>' />
                    <br />
                    <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" 
                        CommandName="Insert" Text="Insert" />
                    &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" 
                        CausesValidation="False" CommandName="Cancel" Text="Cancel" />
                </InsertItemTemplate>
                                
            </asp:FormView>
		</div>
    </form>
</asp:Content>
